package io.geekidea.springbootplus.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.system.entity.SysOrder;
import io.geekidea.springbootplus.system.enums.StateEnum;
import io.geekidea.springbootplus.system.mapper.SysOrderMapper;
import io.geekidea.springbootplus.system.service.SysOrderService;
import io.geekidea.springbootplus.system.vo.SysOrderQueryVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class SysOrderServiceImpl extends BaseServiceImpl<SysOrderMapper, SysOrder> implements SysOrderService {
    @Autowired
    private SysOrderMapper sysOrderMapper;


    @Override
    public boolean addOrder(SysOrder order) throws Exception {
        System.out.println(order);
        return sysOrderMapper.insertOrder(order) > 0;
    }

    @Override
    public boolean deleteOneOrder(Long id) throws Exception {
        return sysOrderMapper.deleteOrder(id) > 0;
    }


    @Override
    public List<SysOrderQueryVo> selectAllOrderByMemberId(Integer memberId) throws Exception {
        return sysOrderMapper.selectOrderByMemberId(memberId);
    }


}
